package com.hwh.controller;

import java.io.IOException;
import java.util.ArrayList;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import com.hwh.service.GoodsService;
import com.hwh.serviceIm.GoodsServiceImpl;
import com.hwh.vo.Goods;

public class SelAllGoodController extends HttpServlet{
	
	protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		super.doPost(req, resp);
	}

	protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {

		ArrayList<Goods> goods = new ArrayList<Goods>();
		GoodsService gd = new GoodsServiceImpl();

		goods = gd.getGoods();

		// 将goods对象放入session中,前台用EL表达式获取值
		HttpSession session = req.getSession();

		session.setAttribute("goods", goods);

		req.getRequestDispatcher("agoods.jsp").forward(req, resp);

	}
}
